package org.gruposp2p.proyectokarma.gwt.client.ui.vote;

import org.gruposp2p.proyectokarma.gwt.client.ui.document.DocumentsTablePanel;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

public class SearchVotePanel extends Composite {

	private static SearchVoteUiBinder uiBinder = GWT
			.create(SearchVoteUiBinder.class);

	interface SearchVoteUiBinder extends UiBinder<Widget, SearchVotePanel> {	}

	@UiField VerticalPanel mainPanel;
	@UiField VerticalPanel bodyPanel;
    @UiField Button launchChart;
	
    int xPopupPos = Window.getClientWidth()/4;
    int yPopupPos = 40;
	
	public SearchVotePanel() {
		initWidget(uiBinder.createAndBindUi(this));
		bodyPanel.add(new VotesTablePanel());
	}
	
    @UiHandler("launchChart")
    void handleAcceptButton(ClickEvent e) {
    	ResultsDialog resultsDialog = new ResultsDialog ();
    	resultsDialog.show(xPopupPos, yPopupPos);
        xPopupPos += 10;
        yPopupPos += 10;
    }

}
